<template>
  <div class="home">
    <!-- <div :style="{ background: $store.state.color }">这是首页的div</div> -->
    <div v-bg>这是首页的div</div>
    <button @click="getDetail">获取商品详情</button>
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from "@/components/HelloWorld.vue";
// import http from "../utils/http.js";

import { getBanner, getDetailData } from "../utils/api.js";

export default {
  name: "HomeView",
  components: {
    HelloWorld,
  },
  created() {
    getBanner().then((res) => {
      console.log(res);
    });
  },
  methods: {
    getDetail() {
      getDetailData({ id: 80 }).then((res) => {
        console.log(res);
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.box {
  background: rgb(143, 32, 32);
}
</style>
